package com.xunwulian.cmpp.client.service;

import com.xunwulian.base.exception.ErrorCodeException;
import com.xunwulian.api.dto.BaseResponse;
import com.xunwulian.dubbo.iface.CmppCmebAPI;
import com.xunwulian.base.constant.CmebEntity;
import com.xunwulian.base.entity.AppEntity;
import com.xunwulian.cmeb.service.CmebUtil;
import org.springframework.stereotype.Service;

@Service
public class CmppCmebApiImpl implements CmppCmebAPI {

    /**
     * 卡信息实时查询
     *
     * @param msisdn
     * @return
     */
    @Override
    public BaseResponse queryCardInfo(String msisdn, AppEntity appEntity) {

        BaseResponse response = new BaseResponse();
        CmebEntity cmeb = null;
        try {
            CmebUtil cmebUtil = new CmebUtil();
            cmeb = cmebUtil.queryCardInfo(msisdn, appEntity);

        } catch (ErrorCodeException e) {
            response.setCode(e.getCode());
            response.setMsg(e.getMessage());
            e.printStackTrace();
        }
        response.setData(cmeb);

        return response;
    }
}
